package engine.newUi
{
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;

	public class PetManageLogic
	{
		private static  var _self:PetManageLogic
		
		private var _ui:PetUI;
		public static function getInstance():PetManageLogic
		{
			if(_self==null)
			{
				_self=new PetManageLogic();
			}
			return _self;
		}
		public function PetManageLogic()
		{
			_ui = PetUI.getInstance();
		}
		
		/**属性界面**/
		private function get table1():Array
		{
			var arr:Array=[_ui.A_attacktarea1,_ui.A_attacktarea2,_ui.A_bellipotent,_ui.A_bottom1,_ui.A_bottom2,_ui.A_bottom3,_ui.A_bottom4,_ui.A_changName,_ui.A_clueGroup,
			_ui.A_dengji2,_ui.A_developLable,_ui.A_equeGroup,_ui.A_expLoading,_ui.A_expMc,_ui.A_gensui,_ui.A_gradeMC,_ui.A_gradetitle,_ui.A_labbel1,_ui.A_labbel20,_ui.A_labbel5,
			_ui.A_labbel6,_ui.A_labbel7,_ui.A_labbel8,_ui.A_lvLabel,_ui.A_masterycoin1,_ui["A_masterycoin2"],_ui["A_masterycoin3"],_ui["A_masterycoin4"],_ui["A_masterycoin5"],_ui["A_masterycoin6"],_ui["A_masterycoin7"],
			_ui.A_masteryLable,_ui.A_mc3,_ui.A_mc4,_ui.A_mc5,_ui.A_nameLabel,_ui.A_picMc,_ui.A_prolvLab,
			_ui["A_masterycoin8"],_ui.A_remanber,_ui.A_remanber1,_ui.A_veinsmc,_ui.A_zhandou];
		 	return arr;
		}
		/**喂养界面**/
		private function get table2():Array
		{
			var arr:Array=[_ui.B_touxiang,_ui.B_picMC,_ui.B_nameMc,_ui.B_LevelMc,_ui.B_mc6,_ui.B_mc7,_ui.B_labbel2,_ui.B_labbel4,_ui.B_labbel9,_ui.B_labbel11,_ui.B_labbel13,_ui.B_petlvLabel,
				_ui.B_prolvMc,_ui.B_prolvbg,_ui.B_proloadingMc,_ui.B_proloading,_ui.B_loadingLab,_ui.B_petnameLabel,_ui.B_vieGroup,_ui.B_timelabel,_ui.B_numLabel,_ui.B_text1];
			return arr;
		}
		/**传授界面**/
		private function get table3():Array
		{
			var arr:Array=[_ui.E_lnameMc,_ui.E_impartBtn,_ui.E_infoText,_ui.E_jieshao,_ui.E_jieshao,_ui.E_comboBox,_ui.E_rlvLab,_ui.E_rlvMc,_ui.E_rlvbg,_ui.E_llvLab,_ui.E_llvMc,_ui.E_llvbg,_ui.E_lnameLab,
				_ui.E_lnamebg,_ui.E_mc8,_ui.E_star2,_ui.E_picMC2,_ui.E_pic2,_ui.E_star1,_ui.E_picMC1,_ui.E_pic1,_ui.E_title,_ui.E_ImpartAdd,_ui.E_remand1,_ui.E_remand2,_ui.E_remand3,_ui.E_info1,_ui.E_info2,_ui.E_info3];
			return arr;
		}
		/**强化界面**/
		private function get table4():Array
		{
			var arr:Array=[_ui.C_text,_ui.C_textmc1,_ui.C_textmc2,_ui.C_viewGroup];
			return arr;
		}
		/**训练界面**/
		private function get table5():Array
		{
			var arr:Array=[_ui.D_ItemLable2,_ui.D_nameLable,_ui.D_btn,_ui.D_cusceLable,_ui.D_Item,_ui.D_itemLable1,_ui.D_itemLable2,_ui.D_label1,_ui.D_label2,_ui.D_label3,_ui.D_label4,_ui.D_label5,_ui.D_label6,_ui.D_label7,
			_ui.D_label8,_ui.D_label9,_ui.D_label10,_ui.D_label11,_ui.D_label12,_ui.D_label13,_ui.D_label14,_ui.D_label15,_ui.D_label16,_ui.D_label17,_ui.D_label18,_ui.D_mc1,_ui.D_mc2,_ui.D_mc3,_ui.D_mc4,_ui.D_mc5,_ui.D_mc6,
			_ui.D_mc7,_ui.D_mcc,_ui.D_pic,_ui.D_upgrade];
			return arr;
		}
		public function setState(state:int):void
		{
			switch(state)
			{
				case 0:
					hide(table2);
					hide(table3);
					hide(table4);
					hide(table5);
					show(table1);
					PetLoic.getInstance().tabel2RemoveEvent();
					PetLoic.getInstance().tabel3RemoveEvent();
					PetLoic.getInstance().tabel4RemoveEvent();
					PetLoic.getInstance().tabel5RemoveEvent();
					PetLoic.getInstance().table1AddEvent();
					break;
				case 1:
					hide(table1);
					hide(table3);
					hide(table4);
					hide(table5);
					show(table2);
					PetLoic.getInstance().tabel1RemoveEvent();
					PetLoic.getInstance().tabel3RemoveEvent();
					PetLoic.getInstance().tabel4RemoveEvent();
					PetLoic.getInstance().tabel5RemoveEvent();
					PetLoic.getInstance().table2AddEvent();
					break;
				case 2:
					hide(table1);
					hide(table2);
					hide(table3);
					hide(table4);
					show(table5);
					PetLoic.getInstance().tabel1RemoveEvent();
					PetLoic.getInstance().tabel2RemoveEvent();
					PetLoic.getInstance().tabel3RemoveEvent();
					PetLoic.getInstance().tabel4RemoveEvent();
					PetLoic.getInstance().table5AddEvent();
					break;
//				case 3:
//					hide(table1);
//					hide(table2);
//					hide(table3);
//					hide(table5);
//					show(table4);
//					PetLoic.getInstance().tabel1RemoveEvent();
//					PetLoic.getInstance().tabel2RemoveEvent();
//					PetLoic.getInstance().tabel3RemoveEvent();
//					PetLoic.getInstance().tabel5RemoveEvent();
//					PetLoic.getInstance().table4AddEvent();
//					break;
				case 3:
				
					hide(table1);
					hide(table2);
					hide(table4);
					hide(table5);
					show(table3);
					PetLoic.getInstance().tabel1RemoveEvent();
					PetLoic.getInstance().tabel2RemoveEvent();
					PetLoic.getInstance().tabel4RemoveEvent();
					PetLoic.getInstance().tabel5RemoveEvent();
					PetLoic.getInstance().table3AddEvent();
					break;
			}
			
		}
	
		private function show(arr:Array):void
		{
			for( var  i:String in arr)
			{
				if(arr[int(i)])
					arr[int(i)].visible=true;
			}
		}
		private function hide(arr:Array):void
		{
			for( var  i:String in arr)
			{
				if(arr[int(i)])
					arr[int(i)].visible=false;
			}
		}
	
	}
}